
varying float height;

varying vec4 lightFactor;

varying vec4 TexCoords0;
varying vec4 TexCoords1;
varying vec4 TexCoords2;

varying vec4 ShadowCoord;

void main()
{
    ShadowCoord= gl_TextureMatrix[7] * gl_Vertex;
    
	vec3 normalVector = normalize(gl_NormalMatrix * gl_Normal);
	vec3 vertexPos = vec3(gl_ModelViewMatrix * gl_Vertex);

	// per vertex lighting
	vec3 L = normalize(gl_LightSource[0].position.xyz - vertexPos);
        vec4 Idiff = gl_FrontLightProduct[0].diffuse * max(dot(normalVector,L), 0.0);
        lightFactor = clamp(Idiff, 0.0, 1.0);

   	vec3 E = normalize(-vertexPos); // we are in Eye Coordinates, so EyePos is (0,0,0)  
   	vec3 R = normalize(-reflect(L,normalVector));  

	vec4 Ispec = gl_FrontLightProduct[0].specular * pow(max(dot(R,E),0.0),0.3*gl_FrontMaterial.shininess);
        lightFactor += clamp(Ispec, 0.0, 1.0); 

	TexCoords0 = gl_MultiTexCoord0;
	TexCoords1 = gl_MultiTexCoord1;
	TexCoords2 = gl_MultiTexCoord2;

	
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

}

